package com.example.weight.householdWaste;

import androidx.appcompat.app.AppCompatActivity;
import com.example.weight.R;
import com.example.weight.greenSeasons.SolidLiquid.SolidLiquidDailyInspectorActivity;
import com.example.weight.greenSeasons.SolidLiquid.SolidLiquidDailyMaintenanceActivity;
import com.example.weight.greenSeasons.SolidLiquid.SolidLiquidWeekInspectorActivity;
import com.example.weight.greenSeasons.SolidLiquid.SolidLiquidWeekMaintenanceActivity;
import com.example.weight.greenSeasons.SolidLiquid.chuzha7_2;
import com.example.weight.greenSeasons.SolidLiquid.chuzha7_2Jiancharen;
import com.example.weight.greenSeasons.SolidLiquid.chuzha7_2Jiancharen_old;
import com.example.weight.greenSeasons.SolidLiquid.chuzha7_2_old;
import com.example.weight.greenSeasons.SolidLiquid.ribaoyang7_5;
import com.example.weight.greenSeasons.SolidLiquid.shebeijiancha7_4;
import com.example.weight.greenSeasons.SolidLiquid.shebeijiancha7_4_old;
import com.example.weight.greenSeasons.SolidLiquid.shebeijiancha7_4jiancharen;
import com.example.weight.greenSeasons.SolidLiquid.shebeijiancha7_4jiancharen_old;
import com.example.weight.greenSeasons.SolidLiquid.shebeiyunxing7_1;
import com.example.weight.greenSeasons.SolidLiquid.shebeiyunxing7_1jiancharen;
import com.example.weight.greenSeasons.SolidLiquid.yuebaoyang7_6;
import com.example.weight.greenSeasons.SolidLiquid.yuebaoyangNav;
import com.example.weight.greenSeasons.SolidLiquid.zhoubaoyang;
import com.example.weight.greenSeasons.compost.CompostFacilityCheck;
import com.example.weight.greenSeasons.compost.CompostFacilityCheckInspector;
import com.example.weight.greenSeasons.compost.duifeishebeijiancha;
import com.example.weight.greenSeasons.compost.duifeishebeijiancha_jiancharen;
import com.example.weight.greenSeasons.flocculation.xuningribaoyang;
import com.example.weight.greenSeasons.flocculation.xuningribaoyang_old;
import com.example.weight.greenSeasons.flocculation.xuningshebeijiancha;
import com.example.weight.greenSeasons.flocculation.xuningshebeijianchaChecker;
import com.example.weight.greenSeasons.flocculation.xuningshebeijianchaChecker_old;
import com.example.weight.greenSeasons.flocculation.xuningshebeijiancha_old;
import com.example.weight.greenSeasons.flocculation.xuningyuebaoyang;
import com.example.weight.greenSeasons.flocculation.xuningyuebaoyang_nav;
import com.example.weight.greenSeasons.waterDeal.EquipmentCheckNavTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentCheckNavTable_old;
import com.example.weight.greenSeasons.waterDeal.EquipmentCheckTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentCheckTable_old;
import com.example.weight.greenSeasons.waterDeal.EquipmentDailyInspectorTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentDailyMaintainTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentMonthlyInspectorTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentMonthlyMaintainNavTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentMonthlyMaintainNavTable_old;
import com.example.weight.greenSeasons.waterDeal.EquipmentMonthlyMaintainTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentRunningTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentRunningTableCheck;
import com.example.weight.greenSeasons.waterDeal.EquipmentWeeklyInspectorTable;
import com.example.weight.greenSeasons.waterDeal.EquipmentWeeklyMaintainTable;
import com.example.weight.navigation.SijiqingSolidLiquidSepNavActivity;
import com.hjq.bar.OnTitleBarListener;
import com.hjq.bar.TitleBar;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

public class ChoseRoleActivity extends AppCompatActivity {

    private String fName, factory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chose_role);

        Intent previousIntent = getIntent();
        String name = previousIntent.getStringExtra("name");
        fName = previousIntent.getStringExtra("fName");
        factory = previousIntent.getStringExtra("factory");

        TitleBar titleBar = findViewById(R.id.role_select_titleBar);
        titleBar.setOnTitleBarListener(new OnTitleBarListener() {
            @Override
            public void onLeftClick(View v) { finish(); }

            @Override
            public void onTitleClick(View v) {}

            @Override
            public void onRightClick(View v) {}
        });

        RadioGroup radioGroup = findViewById(R.id.role_select_group);
        radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
            RadioButton button = findViewById(checkedId);
            String role = button.getText().toString();

            if(fName.equals("chuzha7_2")){
                if(role.equals("操作人")){
                    Intent intent = new Intent(this, chuzha7_2.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(this, chuzha7_2Jiancharen.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("chuzha7_2_old")){
                if(role.equals("操作人")){
                    Intent intent = new Intent(this, chuzha7_2_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(this, chuzha7_2Jiancharen_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("shebeiyunxing7_1")){
                if(role.equals("操作人")){
                    Intent intent = new Intent(this, shebeiyunxing7_1.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(this, shebeiyunxing7_1jiancharen.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("shebeijiancha7_4_old")) {
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, shebeijiancha7_4_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, shebeijiancha7_4jiancharen_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("shebeijiancha7_4")) {
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, shebeijiancha7_4.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, shebeijiancha7_4jiancharen.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("CompostFacilityCheck")){
                if(role.equals("操作人")){
                    Intent intent = new Intent(this, CompostFacilityCheck.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(this, CompostFacilityCheckInspector.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("duifeishebeijiancha")){
                if(role.equals("操作人")){
                    Intent intent = new Intent(this, duifeishebeijiancha.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(this, duifeishebeijiancha_jiancharen.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("shebeiyunxing8_1")){
                Intent intent;
                if(role.equals("操作人")){
                    intent = new Intent(this, EquipmentRunningTable.class);
                }else {
                    intent = new Intent(this, EquipmentRunningTableCheck.class);
                }
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if (fName.equals("equipmentRunningCheck")){
                Intent intent = new Intent(this, EquipmentRunningTableCheck.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if(fName.equals("shebeijiancha8_4")) {
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, EquipmentCheckTable.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, EquipmentCheckNavTable.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("shebeijiancha8_4_old")) {
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, EquipmentCheckTable_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, EquipmentCheckNavTable_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("equipmentDailyMaintain")) {
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, EquipmentDailyMaintainTable.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, EquipmentDailyInspectorTable.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("equipmentWeeklyMaintain")) {
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, EquipmentWeeklyMaintainTable.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, EquipmentWeeklyInspectorTable.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("equipmentMonthlyMaintain")) {
                Intent intent = new Intent(this, EquipmentMonthlyMaintainNavTable.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if(fName.equals("equipmentMonthlyMaintain_old")) {
                Intent intent = new Intent(this, EquipmentMonthlyMaintainNavTable_old.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }
            else if(fName.equals("WaterEquipmentMonthlyMaintainNavTable")){
                Intent intent = new Intent(this, EquipmentMonthlyMaintainNavTable.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if(fName.equals("WaterEquipmentMonthlyMaintainNavTable_old")){
                Intent intent = new Intent(this, EquipmentMonthlyMaintainNavTable_old.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if(fName.equals("xuningshebeijiancha")){
                if(role.equals("操作人")){
                    Intent intent = new Intent(this, xuningshebeijiancha.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(this, xuningshebeijianchaChecker.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("xuningshebeijiancha_old")){
                if(role.equals("操作人")){
                    Intent intent = new Intent(this, xuningshebeijiancha_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }else{
                    Intent intent = new Intent(this, xuningshebeijianchaChecker_old.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("xuningyuebaoyang_nav")){
                Intent intent = new Intent(this, xuningyuebaoyang_nav.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if(fName.equals("xuningribaoyang_nav")){
                Intent intent = new Intent(this, xuningribaoyang.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if(fName.equals("xuningribaoyang_nav_old")){
                Intent intent = new Intent(this, xuningribaoyang_old.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }else if(fName.equals("xuningzhoubaoyang_nav")){
                Intent intent = new Intent(this, xuningribaoyang.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            //固液分离保养部分
            }else if(fName.equals("SolidLiquidDailyMaintenance")){
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, SolidLiquidDailyMaintenanceActivity.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, SolidLiquidDailyInspectorActivity.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("SolidLiquidWeekMaintenance")){
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, SolidLiquidWeekMaintenanceActivity.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, SolidLiquidWeekInspectorActivity.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else if(fName.equals("SolidLiquidMonthMaintenance")){
//                Intent intent = new Intent(this, yuebaoyangNav.class);
//                intent.putExtra("name", name);
//                intent.putExtra("role", role);
//                startActivity(intent);
                if (role.equals("操作人")) {
                    Intent intent = new Intent(this, yuebaoyangNav.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(this, yuebaoyangNav.class);
                    intent.putExtra("name", name);
                    intent.putExtra("role", role);
                    intent.putExtra("factory", factory);
                    startActivity(intent);
                }
            }else{
                Intent intent = new Intent(this, HouseholdWasteMaintainNavActivity.class);
                intent.putExtra("name", name);
                intent.putExtra("role", role);
                intent.putExtra("factory", factory);
                startActivity(intent);
            }
        });
    }
}